#pragma once


template <class iterator,class Ref,class Pef>
class ReverseIterator
{
public:
	ReverseIterator(iterator _it)
		:it(_it)
	{

	}
	typedef ReverseIterator<iterator,Ref,Pef> self;
	self& operator++()
	{
		--it;
		return *this;
	}
	self operator++(int)
	{
		self tmp(*this);
		--it;
		return tmp;
	}
	self& operator--()
	{
		++it;
		return *this;
	}
	self operator--(int)
	{
		self tmp(*this);
		++it;
		return tmp;
	}
	Ref operator*()
	{
		iterator tmp = it;
		--tmp;
			return *tmp;
	}
	Pef operator->()
	{
		iterator tmp = it;
		--tmp;
		return tmp.operator->();
	}
	bool operator==(const self& x)
	{
		return it == x.it;
	}
	bool operator!=(const self& x)
	{
		return it != x.it;
	}
private:
	iterator it;
};